package array;

/**
 *
 * 输入：x = 121
 * 输出：true
 */
public class L9 {
    public boolean isPalindrome(int x) {
        if (x < 0){
            return false;
        }
        String s = String.valueOf(x);
        char[] chars = new char[s.length()];
        int i = 0, j = chars.length - 1;
        while (i < j){
            if (s.charAt(i) != s.charAt(j)){
                return false;
            }
            j--;
            i++;
        }
        return true;


    }
}
